deserializeConfig

fun <T : Any> deserializeConfig(config: T, string: String, errorBuilder: MutableList<String>, flags: Byte = 1): ValidationResult<ConfigContext<T>>

Deserializes a config from a string.

Extension of deserializeFromToml that deserializes directly from a string. Use to read from a file or packet.

Return

Returns ValidationResult of ConfigContext. The validation result includes the config and any applicable errors, and any flag information

Author

fzzyhmstrs

Since

0.2.0

Parameters

T

the config type. can be Any non-null type.

config

the config pre-deserialization

string

the string to deserialize from. Needs to be valid Toml.

errorBuilder

a mutableList of strings the original caller of deserialization can use to print a detailed error log

flags

default IGNORE_NON_SYNC. With the default, elements with the NonSync annotation will be skipped. See the flag options below to serialize the entire config (ex: saving to file), fully syncing (ex: initial sync server -> client), etc.

  • CHECK_NON_SYNC: Byte = 0

  • IGNORE_NON_SYNC: Byte = 1

  • CHECK_RESTART: Byte = 2

  • IGNORE_NON_SYNC_AND_CHECK_RESTART: Byte = 3

  • IGNORE_VISIBILITY: Byte = 4